package selcoursesys.entity;

import javax.persistence.*;
import java.sql.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Lpbdz on 2017/4/9.
 */
@Entity
@Table(name = "student", schema = "manage_system", catalog = "")
public class StudentEntity {
    private String stuid;
    private String stuname;
    private String stusex;
    private Date stubirth;
    private String stuIDnum;
    private String sturace;
    private Date stuindate;
    private String mail;
    private String edu;
    private Set course=new HashSet();
    private ClazzEntity clazzByClassid;
    private MajorEntity majorByMajorid;
    private AcademyEntity academyByAid;

    public Set getCourse() {
        return course;
    }

    public void setCourse(Set course) {
        this.course = course;
    }

    @Id
    @Column(name = "stuid")
    public String getStuid() {
        return stuid;
    }

    public void setStuid(String stuid) {
        this.stuid = stuid;
    }

    @Basic
    @Column(name = "stuname")
    public String getStuname() {
        return stuname;
    }

    public void setStuname(String stuname) {
        this.stuname = stuname;
    }

    @Basic
    @Column(name = "stusex")
    public String getStusex() {
        return stusex;
    }

    public void setStusex(String stusex) {
        this.stusex = stusex;
    }

    @Basic
    @Column(name = "stubirth")
    public Date getStubirth() {
        return stubirth;
    }

    public void setStubirth(Date stubirth) {
        this.stubirth = stubirth;
    }

    @Basic
    @Column(name = "stuIDnum")
    public String getStuIDnum() {
        return stuIDnum;
    }

    public void setStuIDnum(String stuIDnum) {
        this.stuIDnum = stuIDnum;
    }

    @Basic
    @Column(name = "sturace")
    public String getSturace() {
        return sturace;
    }

    public void setSturace(String sturace) {
        this.sturace = sturace;
    }

    @Basic
    @Column(name = "stuindate")
    public Date getStuindate() {
        return stuindate;
    }

    public void setStuindate(Date stuindate) {
        this.stuindate = stuindate;
    }

    @Basic
    @Column(name = "mail")
    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    @Basic
    @Column(name = "edu")
    public String getEdu() {
        return edu;
    }

    public void setEdu(String edu) {
        this.edu = edu;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StudentEntity that = (StudentEntity) o;

        if (stuid != null ? !stuid.equals(that.stuid) : that.stuid != null) return false;
        if (stuname != null ? !stuname.equals(that.stuname) : that.stuname != null) return false;
        if (stusex != null ? !stusex.equals(that.stusex) : that.stusex != null) return false;
        if (stubirth != null ? !stubirth.equals(that.stubirth) : that.stubirth != null) return false;
        if (stuIDnum != null ? !stuIDnum.equals(that.stuIDnum) : that.stuIDnum != null) return false;
        if (sturace != null ? !sturace.equals(that.sturace) : that.sturace != null) return false;
        if (stuindate != null ? !stuindate.equals(that.stuindate) : that.stuindate != null) return false;
        if (mail != null ? !mail.equals(that.mail) : that.mail != null) return false;
        if (edu != null ? !edu.equals(that.edu) : that.edu != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = stuid != null ? stuid.hashCode() : 0;
        result = 31 * result + (stuname != null ? stuname.hashCode() : 0);
        result = 31 * result + (stusex != null ? stusex.hashCode() : 0);
        result = 31 * result + (stubirth != null ? stubirth.hashCode() : 0);
        result = 31 * result + (stuIDnum != null ? stuIDnum.hashCode() : 0);
        result = 31 * result + (sturace != null ? sturace.hashCode() : 0);
        result = 31 * result + (stuindate != null ? stuindate.hashCode() : 0);
        result = 31 * result + (mail != null ? mail.hashCode() : 0);
        result = 31 * result + (edu != null ? edu.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "classid", referencedColumnName = "classid", nullable = false)
    public ClazzEntity getClazzByClassid() {
        return clazzByClassid;
    }

    public void setClazzByClassid(ClazzEntity clazzByClassid) {
        this.clazzByClassid = clazzByClassid;
    }

    @ManyToOne
    @JoinColumn(name = "majorid", referencedColumnName = "majorid", nullable = false)
    public MajorEntity getMajorByMajorid() {
        return majorByMajorid;
    }

    public void setMajorByMajorid(MajorEntity majorByMajorid) {
        this.majorByMajorid = majorByMajorid;
    }

    @ManyToOne
    @JoinColumn(name = "aid", referencedColumnName = "aid", nullable = false)
    public AcademyEntity getAcademyByAid() {
        return academyByAid;
    }

    public void setAcademyByAid(AcademyEntity academyByAid) {
        this.academyByAid = academyByAid;
    }
}
